#pragma once
#include "Control.h"


class GUI_API CBmpBtn :	public CControl
{
public:
	CBmpBtn(void);
	/**
	*@param[in]  nID		 Specifies the  ID       of the control
	*/

	CBmpBtn(UINT nID);
	/**
	*@param[in]  strCaption  Specifies the  caption  of the control 
	*@param[in]  nID		 Specifies the  ID       of the control
	*/

	CBmpBtn(wstring strCaption,UINT nID);
	/**
	*@param[in]  dwStyle Specifies the  style of the control
	*@li @c SWS_STATIC   static control without any vents
	*@li @c SBS_ACTIVE  
	*@li @c SBS_ROUND
	*@li @c SBS_RECT
	*@param[in]  strCaption  Specifies the  caption  of the control 
	*@param[in]  rc           Specifies the  position of the control
	*@param[in]  nID		 Specifies the  ID       of the control
	*/

	CBmpBtn(DWORD dwStyle,wstring strCaption, const CRect &rc, UINT nID);
	/**
	*@param[in]  dwStyle Specifies the  style of the control
	*@li @c SWS_STATIC   static control without any vents
	*@li @c SBS_ACTIVE  
	*@li @c SBS_ROUND
	*@li @c SBS_RECT
	*@param[in]  strCaption  Specifies the  caption  of the control 
	*@param[in]  x           Specifies the  position of the left side of the control
	*@param[in]  y           Specifies the  position of the top  side of the control
	*@param[in]  cx          Specifies the  position of the width of the control
	*@param[in]  cy          Specifies the  position of the control
	*@param[in]  nID		 Specifies the  ID       of the control
	*/

	CBmpBtn(DWORD dwStyle, wstring strCaption, int x, int y, int cx, int cy, UINT nID);

	virtual ~CBmpBtn(void);
	virtual void Click(DWORD dwClick, POINT pt);
	virtual void Paint(CDC* pDC);

public:

	/**
    *@brief Set the bitmap to the button
	*@param[in]  pBmpBtn        The bitmap resource handle
	*@param[in]  bTransparent   TRUE for transparent draw the bitmap;FALSE for normal draw
	*@param[in]  clrTrans       If bTransparent is TRUE,this param is the transparent bit mask color;otherwise it do nothing
	*@return     No return value
	*/

	void SetBmp(HBITMAP pBmpBtn,BOOL bTransparent,COLORREF clrTrans);

	/**
	*@brief Set the text margin to the control
	*@param[in]  szOffset   The margin value,the coordinates are always relative to the upper-left corner of the button.
	*@return     No return value
	*/

	inline void SetTextOffset(CSize szOffset)
	{
		m_szTextOffset = szOffset;
	}

	inline void SetIconNum(int nIconNum)
	{
		m_nIconNum = nIconNum;
	}

	inline void SetRestoreBkgnd(BOOL bRestoreBkgnd)
	{
		m_bRestoreBkgnd = bRestoreBkgnd;
	}

	inline BOOL IsRestoreBkgnd()
	{
		return m_bRestoreBkgnd;
	}

protected:
	CImageList *m_pImgLstBtn;
	int			m_nIconNum;
	CSize		m_szTextOffset;
	CSize		m_szIcon;
	BOOL		m_bRestoreBkgnd;

protected:
	void Init();
};
